home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
AmiTCP30b2.lha
/
src
/
appl
/
napsaterm
/
tel_subneg.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-14
|
1KB
|
68 lines
/*
* $Id: tel_subneg.c,v 3.1 1994/05/14 14:17:07 ppessi Exp $
*
* Author: Tomi Ollila <too@cs.hut.fi>
*
* Copyright © 1993, 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* Created: Thu Apr 7 18:45:42 1994 too
* Last modified: Fri May 13 02:42:26 1994 ppessi
*
* HISTORY
* $Log: tel_subneg.c,v $
* Revision 3.1 1994/05/14 14:17:07 ppessi
* initial revision
*
* Revision 3.1 1994/04/17 11:31:54 too
* initial revision
*
*/
#include "telnet.h"
#include <arpa/telnet.h>
#include "tel_subneg.h"
#include "tel_iacout.h"
#include "napsaprefs.h"
int subneg(u_char c)
{
static enum { sb_start, sb_end, sb_end_2, sb_terminal, } substate = sb_start;
switch (substate) {
case sb_start:
switch (c) {
case TELOPT_TTYPE:
substate = sb_terminal;
break;
default:
return TRUE;
}
break;
case sb_terminal:
if (c == TELQUAL_SEND) {
putiacstring(TELOPT_TTYPE,
np.remoteterm ? np.remoteterm : termnames[np.emulation]);
}
substate = sb_end;
break;
case sb_end:
if (c == IAC) {
substate = sb_end_2;
}
break;
case sb_end_2:
if (c == SE) {
substate = sb_start;
return TRUE;
}
break;
}
return FALSE;
}